import FcDesigner from './FcDesigner.vue';
import DragTool from './DragTool.vue';
import Struct from './Struct.vue';
import Fetch from './Fetch.vue';
import Validate from './Validate.vue';
import DragBox from './DragBox.vue';
import formCreate from '@form-create/element-ui';
import FcEditor from '@form-create/component-wangeditor';
import './style/index.css';
import draggable from 'vuedraggable';
import unique from '@form-create/utils/lib/unique';
import {makeOptionsRule} from './utils/index';
//rewrite form create comp
import myUpload from '@/components/formDesigner/compfc/upload/src/component'
//自定义组件
import tablePaging from '@/components/formDesigner/comp/tablePaging/index'
import dialogComponent from '@/components/formDesigner/comp/dialogComponent/index'
import loadDataAuto from '@/components/formDesigner/comp/loadDataAuto/index'
import submitButton from '@/components/formDesigner/comp/submitButton/index'
import formLayout from '@/components/formDesigner/comp/formLayout/index'
import formItem from '@/components/formDesigner/comp/formItem/index'


formCreate.component('draggable', draggable);
formCreate.component('DragTool', DragTool);
formCreate.component('DragBox', DragBox);
formCreate.component('Validate', Validate);
formCreate.component('Struct', Struct);
formCreate.component('Fetch', Fetch);
formCreate.component('FcEditor', FcEditor);
formCreate.component('tablePaging', tablePaging);
formCreate.component('dialogComponent', dialogComponent);
formCreate.component('loadDataAuto', loadDataAuto);
formCreate.component('submitButton', submitButton);
formCreate.component('formLayout', formLayout);
formCreate.component('formItem', formItem);
formCreate.component('myUpload', myUpload);


formCreate.register('_fc', {
    init(fc, rule) {
        rule._id = unique();
        if (fc.repeat)
            rule.field = unique();
        if (fc.value) {
            rule.effect._fc = false;
        }
    }
});

formCreate.register('_fc_tool', {
    init(_, rule) {
        rule.props.unique = unique();
    }
});

FcDesigner.install = function (Vue) {
    Vue.component('FcDesigner', FcDesigner);
};

FcDesigner.makeOptionsRule = makeOptionsRule;

export default FcDesigner;
